package reflect;

import reflect.annotation.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * 访问注解上的参数
 */
public class ReflectDemo12 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Person");
        Method method = cls.getMethod("sayHello");
        if(method.isAnnotationPresent(AutoRunMethod.class)){
           AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            int value = arm.value();
            System.out.println("注解的参数:"+value);
        }

    }
}
